import http from "@/utils/request";

export const getDrug = (params) => {
  //返回药品列表
  return http.get("/drug/page", {
    params: {
      curPage: params.curPage,
      limit: params.limit,
      sname: params.sname,
    },
  });
};
export const getSupplier = (params) => {
  //返回供应商列表
  return http.get("/supplier/list");
};

export const addDrug = (data) => {
  //增加药品
  return http.post("/drug/addDrug", data);
};
export const editDrug = (data) => {
  //更新药品
  return http.post("/drug/editDrug", data);
};
export const delDrug = (param) => {
  //删除药品
  const myparams = new URLSearchParams();
  myparams.append("did", param);
  return http.post("/drug/delDrug/", myparams);
};
export const getSupplierName = (params) => {
  //返回供应商列表
  return http.get("/supply/getNameByDrugId", {
    params: {
      did: params.did,
    },
  });
};

export const getOneDrugPriceByDrugId = (params) => {
  //返回价格
  return http.get("/drug/getOneDrugPriceByDrugId", {
    params: {
      did: params.did,
    },
  });
};
